package com.lb.action;


import java.util.List;

import javax.servlet.ServletRequest;

import org.apache.struts2.ServletActionContext;

import com.lb.bean.Message;
import com.lb.bean.Reply;
import com.lb.service.MessageService;
import com.opensymphony.xwork2.ActionSupport;

public class MainShowAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private MessageService service;
	private List<Message> messageshow;
	private List<Reply> replylist;
	
	
	

	public List<Message> getMessageshow() {
		return messageshow;
	}

	public void setMessageshow(List<Message> messageshow) {
		this.messageshow = messageshow;
	}

	public List<Reply> getReplylist() {
		return replylist;
	}

	public void setReplylist(List<Reply> replylist) {
		this.replylist = replylist;
	}

	public MessageService getService() {
		return service;
	}

	public void setService(MessageService service) {
		this.service = service;
	}




	public String execute() throws Exception {
		this.clearActionErrors();	

		ServletRequest request=ServletActionContext.getRequest();
		int messageId=Integer.parseInt(request.getParameter("messageId")); 
		System.out.print(messageId);
		messageshow=this.service.findmessageBymessageId(messageId);
	    replylist=this.service.findreplyBymessageId(messageId);
		return SUCCESS;
	
	}
}


